<?php

/**
 * Define path to application directory
 */
defined('APPLICATION_PATH')
    || define('APPLICATION_PATH',
              realpath(dirname(__FILE__) . '/../application'));

/**
 * Define application environment
 */
defined('APPLICATION_ENV')
    || define('APPLICATION_ENV',
              (getenv('APPLICATION_ENV') ? getenv('APPLICATION_ENV')
                                         : 'default'));

/**
 * Define template path
 */
defined('TEMPLATE_PATH')
    || define('TEMPLATE_PATH',
              APPLICATION_PATH . "/modules/default/backyard/views/templates");

/**
 * Include library
 */
set_include_path(implode(PATH_SEPARATOR, array(
    dirname(__FILE__) . '/../libraries',
    get_include_path(),
)));

/**
 * Define domain path
 */
$strHost = $_SERVER['SERVER_NAME'];
// Check SSL link
if (isset($_SERVER['HTTPS']) == true && $_SERVER['HTTPS'] == 'on') {
	$strHost = 'https://' . $strHost;
} else {
	$strHost = 'http://' . $strHost;
}

defined('DOMAIN_PATH')
    || define('DOMAIN_PATH',
              $strHost . dirname($_SERVER["PHP_SELF"]));

/** 
 * Zend_Application 
 */
require_once 'Zend/Application.php';
$strEnvironment = APPLICATION_ENV;
$strOptions = APPLICATION_PATH . '/configs/application.ini';

$objApplication = new Zend_Application($strEnvironment, $strOptions);
$objApplication->bootstrap()->run();
